Rewritten grader.js for submission