useful bits of code