Moved pprinting code into its class