simplified logout code for switching Tab