Ok, I thought by priority you meant that we could see in that order and the later would work. But, basically, by priority, I think you meant that once a cell is set, even if we set the format at the row level, this will be ignored as we already set something higher in the chain of priority.
I will refactor this and will let you know.