trying to get globals working

and other refinements