After using CSG my mesh gets messed up with lots of more vertices and faces than needed. I made a simple fiddle to show an example.

https://jsfiddle.net/apbln/k5ze30hr/41/

This is a simplified version of how my surfaces look like after using csg. How could I possibly know which vertices are real corners and delete the rest and create right faces instead of the previous ones?

I know I could get the surface by grouping all vertices with the same normals, but even after that, how do I know which of their vertices are the corners from which I could then create two correct faces?