Merging C# helpers from the XNA based project, added comments and formatted code.