change which to return rather than show

This is in response to discussion in #5566. I would be happy with either being merged :)