make header, footer mechanism more generalized