A chain is no stronger than its weakest link, and life is after all a chain.
The best way to refactor a program is to refactor it.