Formated the code so naming pref is only set on selcted tab
fixes #9