refactoring grade_mod