Currently, the hierarchy is are stored in ~/.config/menus/applications-kmenuedit.menu. This is both opaque, not portable, and may cause unpredictable behavior as the same configuration is stored in two places. Could the caterogories and just be written to actual desktop files instead?