updated to allow for user defined indices