refactoring grader.js from start