Added energy calculation, verified correctness of gravity calculation