defrecord and protocol for pp