extract head and footer