@moocat this script is working fine and the signature is sorted properly already. Many changes have been made to this code since your last post, including changes to address the problems that your were having before.
Thanks for your interest in this script, as it was your post that caused me to take a closer look at this script and make it better :)