Cleaned up code using resharper