moved error codes and templating to Energy