Implemented events instead of callbacks, full example in events.html