Small refactoring
Added logout functionality