move some globals into prototypes