added the use of valid to restrict the search, need to check the results 2morrow