In reply to Ian Wakeling.

Thanks. I have updated the program to sort the input groups.