Fixes something like 50% of the TS issues. Will spend more time on this soon.