rewriting snippets