hacked a first version of a more performant match