Added a function for selecting a different database index