Approach in the previous commit was incorrect.

We really do need to do proper refcounting on local variables.
- Arguments being implicitly const means less work, and I like it
  anyway.
- Globals vars must be only in the top-level block of a global scope,
  otherwise they may go uninitialised.