refactoring publish