initial refactoring to move the index to the client