Cleanup & a whole bunch of new logic.