updated code to use dmatch