Refactoring: Moving functionality into objects