code refactor in utils.py