simplify logic around tab generation