Refactors publish and subscribe into private methods
Adds function stubs