move some functions to new module