OpenTab function updated