cleanup of grader.js and merge of logic for both paths