Fixed some issues ReSharper mentioned.