Added logic for finding prime numbers