moving row reordering out to plugin

plugin is untested.