refactor: find contact by direct query instead of looping