refactor and log outs..