factored out Matching to make a simpler top level module