Move all global variables to right places.