Moved to_dict into utils.py