Assorted code snippets