Adding small algorithm sorting data by a key within a multidimension array