[PATCH] TUI enhancements, refactoring and initial-setup support