Thanks for your input, but surely bringing $item out of a hat at the end is what you were criticising me for in the first place?? :)
davidrw's reply above (the most compressed version) removes the problem (typo not withstanding), simply by copying and pasting over my previous code. Therefore there must be a problem in that code, but I have not yet found it. Cheers.