Improve resorting method and introduce a scope to find broken lists' ancestries