performance fixes, and a start on energy