All code from C# part one is refactored