Imporved sort algorithm to determine sub projects