removed globals, still need to do some clean up