removed global vars to static