Improve memory usage in raw events and made them self-contained