Refactoring and adding publisher API, #23