Adding sorting algorithm