no longer dependent on global variables