I was doing a similair problem, and with some help from people on here found that using a do-while loop with a switch instead of four if statements worked best. Check out the last page for some pointers...
http://www.daniweb.com/forums/thread159343.html