tidy the code, add user, login/out,