add while loop to app.rb control program