Rename flatten function.

flatten(x) is used a lot in the various lookup plugins where in each it is slightly different. This is to make this name slightly more unique.