adding matrix indexing