formatted the code snippets