Refined main template system