re-wrote node matching section