Refactoring and starting on pubsub