move some initialize code