Implemented counting and indexing of data.