move some globals into qstate getting passed around, about 1/2 of them