fixed compilation with Visual Studio on Windows.
minor code tweaks.
minor code tweaks.
small code fixes and tweaks.