added better logging of events
added better logging of events - refactored