cleaning + factorizing + refactoring