code snippets from all over the place