cleaned up code using resharper