moving handler proc spawn to listener loop