updating global vars.