Match algorithm fixes and partial tests.