There's a version of 'which' that has more features than the one that's on most of my boxes... not sure how to get the GNU version.