Refactor EnsureMarkerInserted