Template processing system