finished the p_wrapper function
added a test for the wrapper