Improve template creation