Clean up code. Provide for independent hosts, update sample accordingly.