getNextTask added in case no constraints were met