Rearrange the deck chairs

This just moves a bunch of stuff around and cleans up a few little things that were bothering me. There should be no functionality changes.