CSG adding lots of comments and fixing dynamic memory allocation to make it MSVC compliant