Adding listener for events