clean and organize templates