Complete rework of height assignment algorithm.

Group and row heights are now considered first. Any extra space will be unused at the bottom of the card. Rows will be reduced and removed in order of priority if there is not enough space on the card.