move some code out of bin