major upgrades to doPost.py, ready to rerun on cluster