C# code cleanup