Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/SegmentTRSInSectionFromMarkerMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/SegmentTRSInSectionFromMarkerMacro.groovy	(revision 3035)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/SegmentTRSInSectionFromMarkerMacro.groovy	(revision 3036)
@@ -8,14 +8,16 @@
 import org.txm.utils.logger.*
 
 @Field @Option(name="trsDirectory", usage="Dossier qui contient les fichiers TRS", widget="Folder", required=true, def="")
-File trsDirectory;
+		File trsDirectory;
 
 @Field @Option(name="resultDirectory", usage="Dossier résultat TRS", widget="Folder", required=true, def="")
-File resultDirectory;
+		File resultDirectory;
 
 @Field @Option(name="newSectionMarker", usage="The marker, spaces included", widget="String", required=true, def=" *#")
-def newSectionMarker
+		def newSectionMarker
 
+@Field @Option(name="debug", usage="activate debug messages", widget="Boolean", required=true, def="false")
+		boolean debug
 
 if (!ParametersDialog.open(this)) return;
 
@@ -57,7 +59,7 @@
 	ConsoleProgressBar cpb = new ConsoleProgressBar(trsFiles.size())
 	for (File trsFile : trsFiles) {
 		cpb.tick()
-
+		
 		// Open input file
 		def slurper = new groovy.util.XmlParser(false, true, true);
 		slurper.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false) // allow DTD declaration
@@ -84,31 +86,54 @@
 		
 		for (int iTurn = 0 ; iTurn < turns.size() ; iTurn++) {
 			def turn = turns[iTurn]
+			def previousTurn = turn
+			def newTurn = null
 			def start = Float.parseFloat(turn.@startTime)
 			def end = Float.parseFloat(turn.@endTime)
 			
-			String content = turn.text().trim()
-			println "TURN: "+content
-			if (content.startsWith(newSectionMarker)) {
-				println "NEW SECTION !"
-				previousSection = currentSection
-				currentSection = new Node(trsEpisode, "Section", new LinkedHashMap(["type":newSectionMarker, "startTime":turn.@startTime, "endTime":previousSection.attributes()["endTime"]]))
+			if (debug) println "TURN: "
+			
+			def children = turn.children()
+			for (int i = 0 ; i < children.size() ; i++) {
+				def node = children[i]
 				
-				previousSection.attributes()["endTime"] = turn.@startTime
-				turns[iTurn-1].attributes()["endTime"] = turn.@startTime
+				String content = null;
+				if (node instanceof String) {
+					content = node
+				} else if (node instanceof groovy.util.Node && node.name() == "w" && node.text().contains(newSectionMarker)) {
+					content = node.text().trim()
+					start = Float.parseFloat(node.@time)
+				}
 				
-					def children = turn.children()
-					for (int i = 0 ; i < children.size() ; i++) {
-						def node = children[i]
-						if (node instanceof String) {
-							println "FIXING: $node "
-							children.remove(i)
-							i--
-						} else if (node instanceof groovy.util.Node && node.name() == "w" && node.text().contains(newSectionMarker)) {
-							println "FIXING: w $node "
-							children.remove(node)
+				if (content.equals(newSectionMarker)) {
+					if (debug) println "NEW SECTION !"
+					previousSection = currentSection
+					currentSection = new Node(trsEpisode, "Section", new LinkedHashMap(["type":newSectionMarker, "startTime":turn.@startTime, "endTime":previousSection.attributes()["endTime"]]))
+					
+					previousSection.attributes()["endTime"] = start
+					previousTurn.attributes()["endTime"] = turn.@startTime
+					
+					if (i > 0) { // The mark is not at the begining of the turn
+						
+						newTurn = new Node(currentSection, "Turn", new LinkedHashMap())
+						for (def att : turn.attributes()) {
+							newTurn.attributes()[att.getKey()] = att.getValue()
 						}
+						newTurn.attributes()["type"] = newSectionMarker
+						newTurn.attributes()["startTime"] = start
+						turn.attributes()["endTime"] = start
+						
 					}
+					
+					children.remove(i) // remove the mark
+					i--
+					
+				} else if (newTurn != null) {
+					turn.children().remove(i)
+					i--
+					newTurn.children().add(node)
+				}
+				previousTurn = turn
 			}
 			
 			trsSection.remove(turn)
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/CreateTheOtherTurns.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/CreateTheOtherTurns.groovy	(revision 3035)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/CreateTheOtherTurns.groovy	(revision 3036)
@@ -127,36 +127,44 @@
 							
 							inW = false
 							String word = wordBuffer.toString().trim()
-							if (!other && word.startsWith("*")) {
-								//close current Turn and start a 'other' Turn
-								writer.writeEndElement() // current Turn
-								writer.writeCharacters("\n")
-								
-								def tmpInfos = new LinkedHashMap()
-								for (String attr : turnInfos.keySet()) tmpInfos[attr] = turnInfos[attr]
-								tmpInfos["orig-speaker"] = turnInfos["speaker"]
-								
-								if (primarySpeakerIdRegex == null || turnInfos["speaker"] ==~ primarySpeakerIdRegex) { // the current speaker is not the primary speaker
-									tmpInfos["speaker"] = otherNonPrimarySpeakerId
+							if (word.startsWith("*")) {
+								if (other) {
+									println "Warning: found a starting * when one 'other' is already started at "+getLocation()
 								} else {
-									tmpInfos["speaker"] = primarySpeakerId
+									//close current Turn and start a 'other' Turn
+									writer.writeEndElement() // current Turn
+									writer.writeCharacters("\n")
+									
+									def tmpInfos = new LinkedHashMap()
+									for (String attr : turnInfos.keySet()) tmpInfos[attr] = turnInfos[attr]
+									tmpInfos["orig-speaker"] = turnInfos["speaker"]
+									
+									if (primarySpeakerIdRegex == null || turnInfos["speaker"] ==~ primarySpeakerIdRegex) { // the current speaker is not the primary speaker
+										tmpInfos["speaker"] = otherNonPrimarySpeakerId
+									} else {
+										tmpInfos["speaker"] = primarySpeakerId
+									}
+									tmpInfos["startTime"] = currentTime
+									writer.writeStartElement("Turn")
+									for (String attr : tmpInfos.keySet()) {
+										writer.writeAttribute(attr, tmpInfos[attr])
+									}
+									
+									other = true
+									word = word.substring(1)
 								}
-								tmpInfos["startTime"] = currentTime
-								writer.writeStartElement("Turn")
-								for (String attr : tmpInfos.keySet()) {
-									writer.writeAttribute(attr, tmpInfos[attr])
-								}
-								
-								other = true
-								word = word.substring(1)
 							}
 							
 							boolean shouldCloseOtherTurn = false;
-							if (other && word.endsWith("*")) {
-								shouldCloseOtherTurn = true;
-								
-								word = word.substring(0, word.length()-1)
-								other = false
+							if (word.endsWith("*")) {
+								if (other) {
+									shouldCloseOtherTurn = true;
+									
+									word = word.substring(0, word.length()-1)
+									other = false
+								} else {
+									println "Warning: found a ending * when one 'other' is not started at "+getLocation()
+								}
 							}
 							
 							if ("XXX".equals(word)) { // <Event desc="XXX" type="unknown" extent="next"/>
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/PrepareTranscriptionsMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/PrepareTranscriptionsMacro.groovy	(revision 3035)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/PrepareTranscriptionsMacro.groovy	(revision 3036)
@@ -18,8 +18,8 @@
 @Field @Option(name="otherNonPrimarySpeakerId", usage="other non primary id of the other turns", widget="String", required=false, def="")
 		String otherNonPrimarySpeakerId
 		
-@Field @Option(name="nonPrimarySpeakerRegex", usage="other non primary id of the other turns", widget="String", required=false, def="")
-		String nonPrimarySpeakerRegex
+@Field @Option(name="nonPrimarySpeakerIdRegex", usage="other non primary id of the other turns", widget="String", required=false, def="")
+		String nonPrimarySpeakerIdRegex
 		
 @Field @Option(name="newSectionMarker", usage="section marker", widget="String", required=false, def="*#")
 		String newSectionMarker
@@ -52,10 +52,10 @@
 
 File sectionsDirectory = new File(resultDirectory, "sections")
 sectionsDirectory.mkdir()
-gse.runMacro(org.txm.macro.transcription.SegmentTRSInSectionFromMarkerMacro, ["trsDirectory":trsDirectory, "resultDirectory":sectionsDirectory, "newSectionMarker":newSectionMarker])
+gse.runMacro(org.txm.macro.transcription.SegmentTRSInSectionFromMarkerMacro, ["trsDirectory":trsDirectory, "resultDirectory":sectionsDirectory, "newSectionMarker":newSectionMarker, "debug":debug])
 
 
-println "CREATE THE 'OTHER' TURNS..."
+println "CREATING THE 'OTHER' TURNS..."
 
 trsFiles = sectionsDirectory.listFiles().findAll(){it.getName().toLowerCase().endsWith(".trs")}
 if (trsFiles.size() == 0) {
@@ -75,6 +75,7 @@
 	
 	if (!fixer.process(outFile)) {
 		println "WARNING: ERROR WHILE PROCESSING: "+file
+		if (debug) {println "DEBUG ACTIVATED -> STOP"; return;}
 	}
 }
 cpb.done()
@@ -93,10 +94,11 @@
 	cpb.tick()
 	
 	File outFile = new File(resultDirectory, file.getName())
-	RecodeSpeakers fixer = new RecodeSpeakers(file, outFile, nonPrimarySpeakerRegex, null, otherNonPrimarySpeakerId, otherNonPrimarySpeakerId)
+	RecodeSpeakers fixer = new RecodeSpeakers(file, outFile, nonPrimarySpeakerIdRegex, null, otherNonPrimarySpeakerId, otherNonPrimarySpeakerId)
 	
 	if (!fixer.process()) {
 		println "WARNING: ERROR WHILE PROCESSING: "+file
+		if (debug) {println "DEBUG ACTIVATED -> STOP"; return;}
 	}
 }
 cpb.done()
