Pair matching algo. Some code is pseudo right now

Some variables/slight syntax modifications may be needed to accommodate for the fact that function inputs are coming from SQL data. Hopefully the algo in general makes sense as a whole