Updated dropdown logic so that it selects a specific matching index