Week9 code snippets