Remove the Global declarations, and moved the variables above the node declaration