Incorportated improvements from CIPC Phase 2.
Merge branch 'master' of github.com:tomcdonnell/lib_tom