Refactoring to better support systems with multiple locations, gateways or control systems