Lots of TS mod fixes & additions

As title says.

Original purpose was fixing #5040, but it got a little out of hand ;)
I did some testing and there shouldn't be any crashes, but due to the amount of changes additional testing/reviewing is recommended.