added a function to automatically fill templates