Sort:  

Thanks @phelimint, glad you found it helpful. I wasn't sure how well I wrote this, to be honest. I was trying to make it easy to read and follow, but wasn't sure if that was accomplished.