Hash table optimization for big files.
Rewrite sort without nested functions