clean up the main template