Setup script refactor