update data structures and reorder cards