MDL-43089 More tidy up. Update grades in rest.php when needed.