Added header footer and function