removed extra if's in auth and added comments