added an isPrime method and tested for 9 correctly