adding subscribe and publish def