converted many parameters to globals