Moved some procedural stuff into functions, changed display of host type to string description.