(refactor) refactored language search functions