Add Visual Studio project files and fix some problems

Please see my commits.