adding head and foot functions