Implemented the CLI

CLI is implemented but necessitated small change to all the p*'s. I put
in this change for first 40.