more complexity refactoring