beginning of authentication stuff