cleaned code, added option for default tab.