Some rearranging and ReSharper cleanup