Case statement in main loop