Adding the final parts to the event listener so that the tabs swap