Wire up most of the event related functions