Minor tweaks

- removed a global var
- some stylistic changes