move auxillary functions to separate module