reformatted the code snippets