Use .find rather than .index.