Small update in factor method

Flatten single at the start, this way it is flat in the bad case and in
the recursive case.
Unfactor method

factoring takes a factor result and gives a string representation. This
way we can check that factor got it right.