switched to use explicit recursion; justification: reduce is not applicable because the event queue may increase and an atom queue would be a stupid, explicit while-loop is less functional than explicit recursion