Refactored hosts/services handling