Various bits of utility code