Adding states and do while loop

I added more states and put the switch statement into a do while loop.