Improve user login and logoff. Should close #35