Improve tab logic.