Factored couple functions out into utils.py