#446: refactoring templates module.
Migration version fixed.
Merge branch 'dev-templates-refactoring' into dev