hw1 cards refactoring