rewrite of getFactors()