A state of mind where you rewrite code to do it in the RightWay? this time. Probably making a new (if there was any before) specification, certainly using new algorithms and data structures.
When rewriting you can introduce new bugs in a much higher rate then when ReFactoring.
See RefactoringHat, SecondSystemEffect