Refactor event handling to allow an Operation to wait for an event.