internal sort by kind