Refactoring for repetitive code.