Rather than importing code from dynamicmenu.sp line by line, lets start with dynamicmenu.sp and modify it to do what we want.  Also added the old customvotes_advanced.sp temporarily for code we still want from it.