More changes inspired by energynumbers recent pull request.