Move return value dictionary creation into the threshold template