A rewrite of hosts3d to clean up variable names, etc.