Various fixes and cleanups for users and logging in