CFY-1433 extract node instance removal logic to its own function