Mostly working simplified behaviour for pubsub

I would check these types on the external functions subscribe and unsubscribe. Then you don't need the when here. Without the when clause you can differentiate on the function head:

find_vars(pid, ...) -> find_var_finish(uffda_pid_sender, ...);
find_vars(sse, ...) -> find_var_finish(uffda_pid_sender, ...);
...

find_vars_finish(Module, ...) ->
  Ass ...
  {Id, Mass}.