Improve tab behavior.
Clean up some more UI logic.