Added support for template in filename