Fix bugs in logic, and throw more informative exception when id is invalid
Remove EmptySearchResult exception