var eachHeader = function(header, direction, fn) {
  for (var h = header[direction]; h !== header; h = h[direction]) {
    fn(h);
  }
};