removed arrays.sort dependency