Move the matching functionality in its own module