Refactor tab related stuffs