refactor tui