Cache headers instead of deep copying every time

Bullet 2 from #234