removed $hostdomain as it broke, will look into it later