add index method
adjust tests and class to initialize with an array