Finished implementing Energy. Added debug mode. Fixed issues #90 and #91.