Generalize get_snippet into extract_snippet_from_doc
Reformat bad style
Refactor: better name
Refactor: better name