Eh? Free variables make this stuff pretty hard to reason about (this file is already getting a little hard to reason about given all the spaghetti -- which is my fault, but let's not make it worse :) )

Let's pass vars through params if they're necessary, not rely on file-wide globals