     ]
     THEN FALSE
     ELSE
-    TRUE 
+    TRUE
     END AS is_applicable
     FROM ' || LOWER(designation_name) || '_all_listing_changes_mview all_listing_changes_mview
     JOIN cites_eu_tmp_taxon_concepts_mview taxon_concepts_mview
-    ON all_listing_changes_mview.affected_taxon_concept_id = taxon_concepts_mview.id 
+    ON all_listing_changes_mview.affected_taxon_concept_id = taxon_concepts_mview.id
     WHERE all_listing_changes_mview.affected_taxon_concept_id = $1
     AND timeline_position = 1
 

    hi.change_type_id,
    hi.event_id,
    hi.effective_at,
    CASE 
    WHEN (
        hi.inclusion_taxon_concept_id IS NOT NULL
        AND AVALS(listing_changes_timeline.context) @> ARRAY[hi.taxon_concept_id::TEXT]

    WHEN listing_changes_timeline.context -> hi.species_listing_id::TEXT = hi.taxon_concept_id::TEXT
    OR hi.taxon_concept_id = listing_changes_timeline.original_taxon_concept_id
    -- this line to make Moschus leucogaster happy
    OR AVALS(listing_changes_timeline.context) @> ARRAY[hi.taxon_concept_id::TEXT]
    THEN TRUE
    WHEN listing_changes_timeline.context = ''''::HSTORE  --this would be the case when deleted
    AND (
