basic cleanup by moving stuff into separate files and throwing out some cruft