Add sorting to index method