Further improved login/logout behavior. Will now write specs.