Added functionality to extract the first-found key.