Fixes dict search. Adds more tests.