refactoring and tossing things around quite a bit