No matter how well-written your application is, you will need to refactor and clean up the technical debt over time, especially when the proper maintenance and updates have been lacking.
When your application was first envisioned, it probably had a clear set of specifications and one or two enthusiastic developers who were committed to quality.
Over time, however, they moved on and other people got involved as the specifications evolved and changed. Now you probably have a bit of a mess that may even be written in a language or platform that is no longer supported. If the language is deprecated, the code has become unstable, and developers can't develop simple features in a reasonable amount of time; it’s probably time to modernize.