add sorting of input tasks