various updates; new template system