Cleans up pubsub implementation.