Make p-value calculations more numpythonic

Also slightly faster than before.