added user auth logic