optimizations + upgrade to VS2012