Use sort_by{ |c| c[0] } instead of sort