Imported a few things from dynamicmenu.sp