templates and instances for entity declarations