- added subscribe for events
- changed on-unload to on-leave