Refactor. Merge EventHandler, EventQueue and worker logic to a single class. Add some documentation.