moved remove event listener to end of method