minor fixes and rearranging code
minor fixes for submenu