implement most the of the material editing energies, add test cases.