Simplify auth code a bit