Code refactoring (with a little help from ReSharper);