Added some filters to the node matching function.