Got UnitTests?
Take a minute or two before you start adding the new functionality. Muck about with the code until you aren't irritated by it any more: move methods around, change their names, whatever you feel like doing. Do it in small bites, and run your UnitTests every time you change something. If you break something, go back to whatever you just did, figure out the problem, and fix it.
There, that wasn't too hard, was it? Didn't take long, either. And now you feel better about your code, so when you go on and add the new piece of code you'll be happier and more focused on it because you won't have the niggling irritation in the back of your mind.
This page mirrored in WikiPagesAboutRefactoring as of July 17, 2004