Refactor code by removing redundancies for easier maintainability.