Refactor _head and _foot