added global var to hold functions value