listener refactored