Extract duplicated code to pull global header/footer into helper functions.