moving hostname function into index.js body