I was thinking about having the failed tasks at the end. But the comment above says that we have to preserve the order. Will change that