Refactor Utils.py