Refactor Script