Added logging and template processing.