Pulled out prime numbers logic to separate class to remove duplication