Having this as a helper function would make it clearer what is going on. Maybe `singleTabChange(tab)` ?