Cleanup event listeners and remove function creation from init

There was suprisingly no reason for these functions to be created in every call to `init()`. They are now instead created only once, boosting performance and removing lines from the already bloated init().

(Somewhat) a part of #1146