Working general ordering code.