added while loop to main.rb