Start of prime factoring functionality