Rewrote the NextPrime code, because holy fuck.