aded docs from xP to xR, and fixed a corner case in reduce