Function version. All the logic checks out here from testdata 4-9. I think this is a good one to build from. Ive simplified the comparison algorithm quite a bit which should help. Now to work on the various output parts.