Base for multi-host support

Must do further testing; it's too late for me to continue now.