adding publish function