add tests. modify TSA