some modifications to refine the search tree for wildcards, almost there!