change to make global variable into a local one. (not tested).