Bunch of code cleanup and restructuring. Very good things.  ;)