factor out all core computations into PHModel, reducing complexity of Solution