added operator[] and unit test for it