refactor out adhoc_setup fn