Refactoring and starting logout