Better logic for determining visible header