refactor _publish