Various corrections to event handling and its documentation