Added platform.h and other fixes for MSVC