Finishes matching logic