diff --git a/src/apps/muscles/Backbone.jl b/src/apps/muscles/Backbone.jl
index 21868e65dd545970b26baa197231faf9a1808589..eb4758a59f0e5864392c222e985a7d631015d9b1 100644
--- a/src/apps/muscles/Backbone.jl
+++ b/src/apps/muscles/Backbone.jl
@@ -9,7 +9,7 @@ include("MuscleWidgets.jl")
 using .MuscleWidgets
 
 export hasmodel, getmodel, setmodel, newsequence, getsequence, withsequences,
-       exportsequence, loadsequence
+       exportsequence, loadsequence, deletesequence
 
 # mutable struct Backbone{W}
 #     widget::Union{Nothing, W}
@@ -150,4 +150,20 @@ function loadsequence(session_id, filepath)
     return sequence
 end
 
+function deletesequence(session_id)
+    model = getmodel(session_id)
+    current = model.sequence[].program_name
+    sequences = __sequences__[session_id]
+    lock(sequences) do
+        for (ix, seq) in pairs(sequences)
+            if seq.program_name == current
+                current = ix
+                break
+            end
+        end
+        @assert current isa Int
+        pop!(sequences.cache, current)
+    end
+end
+
 end
diff --git a/src/apps/muscles/app.jl b/src/apps/muscles/app.jl
index b1747ffe13f6e230ad6daefbdc9f7b0233fddf2a..61c0e80282e1e2acef12a0cc88b5db4c78b12ff9 100644
--- a/src/apps/muscles/app.jl
+++ b/src/apps/muscles/app.jl
@@ -50,6 +50,8 @@ const bonito_app = NamedApp(:inherit, Backbone.app)
     @out area_selected = false
     @out new_clipboard_item = false
 
+    @in delete_sequence_click = false
+
     @onchange isready begin
         _, url = init_model(__model__)
         run(__model__, """
@@ -158,6 +160,7 @@ const bonito_app = NamedApp(:inherit, Backbone.app)
     end
 
     @onchange selected_sequence_name begin
+        isempty(selected_sequence_name) && return
         seq = getsequence(back_session_id, selected_sequence_name)
         if !isnothing(seq)
             ix = findfirst(==(selected_sequence_name), sequence_names)
@@ -286,6 +289,35 @@ const bonito_app = NamedApp(:inherit, Backbone.app)
     @onchange area_selected begin
         @notify "Click inside the selected area to assign the setvalue, or press Ctrl while clicking to copy the selection" :info
     end
+
+    @onbutton delete_sequence_click begin
+        isempty(selected_sequence_name) && return
+        # update the model
+        deletesequence(back_session_id)
+        popat!(sequence_names, selected_sequence_index)
+        if length(sequence_names) < selected_sequence_index
+            selected_sequence_index[!] -= 1
+        end
+        if selected_sequence_index == 0
+            n = round(Int, series_length)
+            stop_time = start_time + (n-1) * time_interval
+            time_support = start_time:time_interval:stop_time
+            model = getmodel(back_session_id)
+            muscles = model.overview
+            sequence = MuscleActivity("", time_support, muscles)
+            # update the view
+            selected_sequence_name = ""
+            # update the view
+            sequence_name = ""
+            # update the model
+            model.sequence[] = sequence
+        else
+            # update both the view and model
+            selected_sequence_name = sequence_names[selected_sequence_index]
+        end
+        # update the view
+        notify(sequence_names)
+    end
 end
 
 function dropdown(key, options, label; margin=true, class=nothing)
@@ -330,7 +362,7 @@ function muscle_view(bonito_url=""; channel=":channel")
             textfield("Start time", :start_time, type="number", step="any",
                       disable=:editmode_disable),
         ]),
-        #item(btn("Delete motor program", @click(:delete_sequence_click), color="negative")),
+        item(btn("Delete motor program", @click(:delete_sequence_click), color="negative")),
     ])
 
     Html.div(style=col, [