Refactored logging to events