adding some magic mystic SQL … this might fix the whole ordering
code cleanup