parsing data and sorting algorithm implemented