         # Redefine enclosing let definitions in this module
         Agent.get(:pavlov_callback_defs, fn dict ->
           Stream.filter dict, fn {module, _name} ->
-            String.starts_with?("#{__MODULE__}", "#{module}") && "#{__MODULE__}" != "#{module}"
+            sub_module? module, __MODULE__
           end
         end)
           |> Stream.map(fn {_module, {periodicity, context, fun}} ->

        # Redefine enclosing let definitions in this module
        Agent.get(:pavlov_let_defs, fn dict ->
          Stream.filter dict, fn {module, lets} ->
            String.starts_with? "#{__MODULE__}", "#{module}"
          end
        end)
          |> Stream.flat_map(fn {_module, lets} ->


        # Redefine enclosing subject definitions in this module
        Agent.get(:pavlov_subject_defs, fn dict ->
          Stream.filter dict, fn {module, _subjects} ->
            sub_module? module, __MODULE__
          end
        end)
          |> Stream.flat_map(fn {_module, subjects} ->
