Refactor all the things.

at least it's done. for the most part.