Refactored PubSub a bit.