complexity refactoring