Started Energy API and a few fixes to the code...