add grading, refactor