repaired code snippets