simplify tab drawing code