refactor site setup code