Refactored listener addition and removal