cleaned up papi implementation and added some docs