factor out head elements