Improve logic for hiding/displaying the title.