refactors host.js, adds comments and removes unused pub-sub events