removes redundant ts and cs