Rewrote main and put some work into TUI