Finally got login/logout stuff to work