Restructuring stuff - Requires cleaning!

Restructuring a whole bunch of stuff, needs lots of cleaning and stuff, but seems to work.