Refactored to for simplicity

Use global tab-number-prefixed variables instead of tab variables