Cleanup energy and free energy
Prefer returning 0 than a wrong value
Fix parameters