Fixing event listeners for event bubbling/capturing issues