Clean up C# code