Fixed sorting. No malloc for trie building.