Added p2r, fixed few small bugs