refactor check for when to render header