add code for generating refined match matrix