Added pubsub integration and updated tests