tab hack (badly written, does work like a charm though)