set hostname to variable instead of constantly calling function