add default tab setting to session variable
clean up code
clean up code and add functions to keep active tab selected