updated to subscribe and publish