Added support for automatic hostname replacement.