Put main loop inside 'switch' statement