added refresh and logout menu options and cleaned some code

added refresh and logout menu options and cleaned some code