refactoring of single card game