First implementation of energy