reworked main loop to be cleaner

No functional change - just moved all menu stuff to a separate switch
block