Thanks for this, a real pain to implement otherwise!

Thanks for this, a real pain to implement otherwise!