refactored listeners attachment