added support for publishing and subscribing to different types separately