Add grading mixin and utility functions

Start implementing grading.