Added snippets of useful code.