Thought of a cleaner way to do that tricky "variable from a pipe" bit (via 'xargs').