cleanup: erased code duplication and made removing of all event listeners easier
cleanup: erased code duplication and made removing of all event listeners easier

pfirpfel/image-viewer,pfirpfel/image-viewer