partial conversion to using TS