Research code implementing inverted multiindex structure