Created card flip and unflip function