better events than callbacks.
example code updated to new event paradigm