refactor scripts file