added some utility functions in utils.py