Made the prime test function a little better