use pointer instead of global var
use pointer instead of global var