Update: refactor grades.c