Rewriting your code-base from scratch every now and then is a good investment
Refactor after all new feature additions
Gives you an opportunity to balance the architecture to fit the new features better.
Rewrite your app from scratch every other year
Basecamp does this. retrofitting on top of old code is often more work than rewriting from scratch. Also when you rewrite from scratch you can use the old code as a guide, and avoid making the architectural mistakes you made in the old code. Also rewriting after a period of time gives you the opportunity to add new language concepts and apis that has been created since last you wrote the code.