fixed sort, removed obsolete map()