simplify global variables, tidy