flatten todo data structure