Reformat YAML and add if statements to HB template.