Added login, auth check, and a bunch of other stuff.