code snippets used