Some refactoring based on ReSharper suggestions