move auxiliary functions to util module