Allowing to compose longer sub-templates (greedy algorithm)
Fixing rights