Added cards.py. Some bug fixes