     time = state.replay_speed
     topic = state.topic
 
-    {frame, new_state} =
-      get_and_update_in(state.watched_frame_buffer, fn [frame | buffer] ->
-        {frame, buffer}
-      end)
-
-    new_state =
-      update_in(new_state.frame_buffer, fn buffer ->
-        [frame | buffer]
-      end)
+    {pos, new_state} = get_and_update_in(state.pos, &{&1, &1 - 1})
+    frame = :array.get(pos, state.buffer)
 
     Process.send_after(self(), {:broadcast_prev_frame, :auto}, time)
     PubSub.broadcast(topic, %Frame{data: frame})

    end
  end


  defp broadcast_prev_frame(%{watched_frame_buffer: []} = state) do
    state
  end


    time = state.replay_speed
    topic = state.topic

    {pos, new_state} = get_and_update_in(state.pos, &{&1, &1 + 1})
    frame = :array.get(pos, state.buffer)

    Process.send_after(self(), {:broadcast_next_frame, :auto}, time)
    PubSub.broadcast(topic, %Frame{data: frame})
