Added grading function