move controller code into flashcards.rb