make more exception handling codes specific, and minor code cleanup
move commonly used functions from multiple scripts out of pop2phase.py to utility.py.
add unit tests for summarize.py, and a bit of code clean-up.