CMS-2192 Templates API design.
Fixing mess that went wrong with the last refactoring.