cleanup globals + minor fixes

This PR is conservative. If you agree I would also like to:

- completely remove the `aeslua` global
- fix the style to be more "idiomatic" (no semicolons etc)

but those are design choices so I'm asking first :)