Straighten out dependency handling from r84610 (files) and before (templates)