cleaned up code with resharper