move some code down