refactor publish