Correct cards function to work in all situations