move some hard-coded magic numbers to constants