fixed isPrime, improved tests, other minor changes