movinf further common functions to util.py