Refactor and Add method for renderTab