Code optimizations

Did some minor code optimizations with Resharper and the project now
works with Visual Studio