First functioning draft of hcp_pa (completely untested, probably broken, TBD: unit testing).