This is the first set of refactorings.
All we did was break the generatePrimes function into three smaller functions and promote some variables to static fields of the class.