Added WriteTemplate