Move card grouping to method