upgraded grader.js to write to output file