Replace 'which' with 'command -v' to be POSIX compatible here.