Implementation of Dan's algorithm: starting to derive using structure.
refactoring
Merge branch 'template' of ssh://github.com/lucmoreau/ProvToolbox into template