code cleanup
first take at a grade algorithm