refactor header and footer