Flush events when filtering.
Refactor file.