move some functions into the class since they are not to be generally used.