Made the auth middleware less terrible.