Ported template system from Core to Jasy. Thanks to Sebastian Fastner.