Useful bits of code.