tried to remove global variables