Fixed up the code to build cleanly on VS2010