Remove alternative hostnames, unused imports.

Since resolving the hostname from the environment variable works, no
need for the alternative hostname methods. This means we can remove some
the file io permission request too.

Also just removed imports that are no longer used from all files.