Clean up existing modules

Mostly involves moving and fixing up some of the interfaces
to be split into each appropriate module