ts algo improved