more efficient header iteration