double logic for TS-SCAN