Refactor setup scripts