first version of refactored multi-index search
improving naming and comments, general fixes