         measureCount += repeatedMeasures.measureCount
 	}
 
+    /**
+     Replaces the measure at the given index with a new measure. The measure index takes into consideration
+     repeats. Therefore, the index is the actual index of the measure as it were played.
+     
+     - parameter measureIndex: The index of the measure to replace.
+     - parameter newMeasure: The new measure to replace the old one.
+     - throws: 
+        - `StaffError.RepeatedMeasureCannotBeModified` if the measure is a repeated measure.
+        - `StaffError.InternalError` if index translation doesn't work properly.
+     */
     public mutating func replaceMeasureAtIndex(measureIndex: Int, withNewMeasure newMeasure: Measure) throws {
         let (notesHolderIndex, repeatMeasureIndex) = try notesHolderIndexFromMeasureIndex(measureIndex)
         let newNotesHolder: NotesHolder

        }
        notesHolders[notesHolderIndex] = newNotesHolder
    }
	
	public mutating func startTieFromNoteAtIndex(noteIndex: Int, inMeasureAtIndex measureIndex: Int) throws {
		try modifyTieForNoteAtIndex(noteIndex, inMeasureAtIndex: measureIndex, removeTie: false)
	}
	
	public mutating func removeTieFromNoteAtIndex(noteIndex: Int, inMeasureAtIndex measureIndex: Int) throws {
		try modifyTieForNoteAtIndex(noteIndex, inMeasureAtIndex: measureIndex, removeTie: true)
	}
	
	public func measureAtIndex(measureIndex: Int) throws -> ImmutableMeasure {
        let (notesHolderIndex, repeatMeasureIndex) = try notesHolderIndexFromMeasureIndex(measureIndex)
        if let measureRepeat = notesHolders[notesHolderIndex] as? MeasureRepeat,

            }
            secondMeasure = try mutableMeasureFromNotesHolderIndex(secondNotesHolderIndex.notesHolderIndex, repeatMeasureIndex: secondNotesHolderIndex.repeatMeasureIndex)
            guard secondMeasure?.noteCount > 0 else {
                throw StaffError.NoNextNoteToTie
            }
        } else {
            secondMeasure = nil
