refactoring, added isLoggedIn command.