Small code cleanup
Tidy up some CPP
Fix the build on Windows