refactor create and publish