[DO NOT MERGE] Initial commit of refactor. Still contains old code.

Looks like the per-host HA settings are not mapped correctly yet.