functions no longer reference global variables