moved initialisation in front of the event listeners