Reduce duplication in setup script