Reworked a few things, added some docstrings, bestMatch is now working properly.