Sort:  

And thanks to you with this post who managed to pin down a few mistakes in my code ;)

You are welcome!