refactoring card and add cardFlipping method