Updated with ReSharper code cleanup.