beginning of auth functions