Added function to keep track of energy conservation.