Functions return energy value. Memory leak fixed.