UNTESTED: refactor to task/event based approach