Moved variables into global scope