void loop() 1 void loop() 2

You might want to try this:-
http://www.thebox.myzen.co.uk/Tutorial/State_Machine.html
Others have told me they find it useful.