This is brilliant, thanks! I was trying to do the same sort of thing by hand but yours is way better :)