Extracting envCntl variable out of function