updated code snippets