Refactor flashcard