Bingo - it solved my problem, thank you!
It crossed my mind but the above solution was much more elegant in this case.