working on factoring in doSimplification method