Quick implementation of event scanning.
Clean up some code.