optimizations and better logging for publish action