finish main template