Finished the prime function.