Fixed to work with multiple merged cells.