Added code for backend flashcard processing