first draft of extract_motif