Rebuilt main template