Logic for making tab active - #4