Ported to Microsoft Visual C++ 2010
Cleaned up merge of msvs port