First off love the mod and the changes you've made from Simwir's version. That said, I made some improvements. Namely, it can handle any sized train as long as at least one carriage has a module in it. (could easily be changed to loco's only if that's better for balancing). I also improved the search for shuttles slightly, it will now ignore trains that can't path the the destination. That ones actually necessary if there are multiple train networks that aren't connected but in close proximity.
Patch file here if you're interested: https://pastebin.com/ddaur8rg