Refactor the grade library to better handle JSON.