Example use of gen_event that seems to work.