Basic changes to compile in .NET 4.0

Implements support for compiling to .NET 4.0 as requested in #40.