Switched to use a direct port of the Python 3 'which' function