Clean up code

No logic change
Initial C# source import

Not tested