Order and refactor scripts