refactored deleteCard method and test.