implement equals and unit tests for indexing