Fleshed out some bugs in the authentication system