Implement first step of matching logic