options.index can now accept a function

pass options to the index function