refactor to remove logout(), the login instead will call logout if it needs to.