speedup queries and first flashcard functionality