We all have to maintain other people's code at some point or another. After killing myself a few times, I realized that there are two possible conditions of existing code that may await your tender loving care:
1) The code is great
2) The code is lousy
So what do you do for each of these cases?
1) great code: you don't need to make many changes
2) lousy code: you're crazy to make any more changes than are absolutely needed
When you have to take existing code and perform substantial maintenance on it, you need to approach it as "the code whisperer." Study it, instrument it, test it, listen to it.
Any piece of existing code is likely to be used in several places and you should not assume that you know all its use cases. Crazy behavior in the code - algorithms, results, side effects - you're dying to fix it. Go carefully. You don't know how much you'll break by "fixing" it.