extracted common functionality to utility_functions.py