Added more indexes, some refactoring to simplify methods.