restructure_recipe <- function(recipe) {
  # Flattens the structure of the recipe to improve the readability of the code
  # System
  if ((length(recipe$Analysis$Datasets$System) == 1) &&
      (is.list(recipe$Analysis$Datasets$System[[1]]))) {
    recipe$Analysis$Datasets$System <- recipe$Analysis$Datasets$System[[1]]
  }
  # Reference
  if ((length(recipe$Analysis$Datasets$Reference) == 1) &&
      (is.list(recipe$Analysis$Datasets$Reference[[1]]))) {
    recipe$Analysis$Datasets$Reference <- recipe$Analysis$Datasets$Reference[[1]]
  }
  # Variable
  if ((length(recipe$Analysis$Variables) == 1) &&
      (is.list(recipe$Analysis$Variables[[1]]))) {
    recipe$Analysis$Variables <- recipe$Analysis$Variables[[1]]
  }
  # Region
  if ((length(recipe$Analysis$Region) == 1) &&
      (is.list(recipe$Analysis$Region[[1]]))) {
    recipe$Analysis$Region <- recipe$Analysis$Region[[1]]
  }
  return(recipe)
}
