revise utils.py, continuing merging of yesterday's work