refactors host.js