move some functions into utils class