Events handling

Included event creation and storage code