vars in functions should be marked 'local'
https://tldp.org/LDP/abs/html/localvar.html#LOCALREF1:
A variable declared as local is one that is visible only within the block of code in which it appears. It has local scope. In a function, a local variable has meaning only within that function block.