using better global variables