lotsa refactoring