added support for event handling (tab switching and new tab loading