refactoring for fun and profit