Support nesting of classes in imenu index creation function.
Add optional flattening to creation of imenu index (again).