match dat spec better
factor out auth logic