cut, testPrime refactored. Comments added