Refactor header-footer loading