Sort phonetic results
Minor refactoring