Update code to comply with C# standards and make code more readable