Added new example to illustrate events. TODO: clean up the code and maybe implement promises.