save events in batch and redo formatting of code