A version of GrandMaster's event and task system (http://www.grandmaster.nu/blog/?page_id=261)