refactor out header and footer