added LargestFactor function to toolkit