Add utils.py, move functions into it.