Upgraded grading script