Right this code was ported from some python code all the mentions of tuples could be changed. Offhand, I do think that they probably should just be sorted here (and the commend above be removed) but I am not super familiar with this code I'd have to study it a little more closely. @pzwang did you write this originally?