Added publish functionality. Added tests to increase coverage.