edit code for recording events