added next_prime function