The barking of the dogs is useful in calling attention to malevolent "pains" or minute disease objects that wander about, particularly at night, while the locking of doors is essential in denying these objects an entrance.
