Refactoring and cleaning out code