hostfile parsing and hierarchy creation