Refactored grader.js