Setup script refactoring