corrected code snippets