template finalization