Some refactoring, part 1
Some refactoring, part 2
Some refactoring, part 3

Much better tab name handling. It actually should be correct now. I
hope.
Some bugfixes

Yeah, it wasn't correct in the end.