Restructuring utils.py