Revise and improve publishing logic