Bits of possibly (re)useful code