refactoring complete. for a while, at least