Refactor deployment scripts