move endpoint code to utils for now