lots of fun refactoring