advanced card magic routines