added indexing
added indexing and fixed tests