Add a first version of the match logic with some tests