Moved variables outside of global scope