Content Index tests and code refactoring