Fixed local vars that polluted the global namespace