Squashed changes for build working both on MSVC and other compilers.