Tidy up code and add some new flashcards