Some refactoring in pmc.py to facilitate adding sign convention later.