Working general ordering code -- many changes