improved auth code