changed to global vars