cleanup of some code and globals

thx to ZeroBrane Studio code analysis!

(hope it doesn't break some ev/moon stuff)