bits of useful code