added publish function