add publish functionality, missing unit tests