More energy meter work

Cleaned up the code for the energy meter widget