Changed Flatten order

Flattened before search.  Increases processing time, but allows for
user-friendly searches of embedded IDs.