Fix some local vars that were polluting global scope

Fix some local vars that were polluting global scope in the orginal Leemon Baird code