first addition of roiSorter code