Various bits of useful code.