moved functions to utils.py