added check for prime function