Cleaned up code using ReSharper