Added error analysis to util.py