Refactor the code and redesign the UI