Moved out reusable functions to util.py
Moved utility functions to util.py