factor out setup code