Added output buffering for events