replacing local xapply with native scp function