Made grading script smarter