Martin Fowler says that we should do refactoring before adding new features (given that the original program is not well-structured).
So we all want to refactor this
Let me recommend the book Working effectively with legacy code by Michael Feathers. It contains a lot of realistic examples and shows good techniques for tackling the legacy code beast.