Update function to search key. Add test.