removed need for specific active tab to be specified in HTML and refactoring