Simplified that tricky "variable from pipe" bit via 'xargs'.