lotsa refactoring!