tweak to fix narrowing cast
Sketched out the functions for writing events from the event buffer