refactored listener traversal to remove existing listeners for overwrite