rewrite to events