Refactored some of the listener code so that no one thinks it's redundant and removes it again