first phase of implementing query matching; specification passing