Refactor the setup scripts