correctly decoding when the final received  symbol is uncoded
cleanup
simplified the search for the pivot element
cleanup