All the stuff to compute energy added