Completed functions starting with P. Added more tests but tests are still sparse.