Updated tuple sort