adding publish method.