move some code in