Move global variables inside functions.