move some repeated code inside the module