refactor legacy apps