add comment, rename variables and simplify codes on getting the uncertainty when trigger are applied