Continuous refactoring. You have to refactor as you go, especially at the design level. When you see broken code or design, be prepared to fix it. This is often a case of fixing something that isn't broken, per se. Except that it is... it's just not manifesting it's brokenness... yet.