cleanup of code snippets and minor edits