added support for adding and removing menuitems