Use real gethostname.
Refactor.