General tidying and moved to .NET 4.5