Main loop case statement edits