finishing patterning code search functions