D-14567 Default value of targetIsRemote re-evaluated
D-14567 Added logic to terminate loop