listener refactoring