cleaned up grades js code