Rewrote p1-p2 to use 'reduce'