Refactoring some code.