refactoring to make more cohesive