begin main template