abstracted index

generalized index implementation added; untested;