Un-hacked my hacky matching algorithm.