optimized TSD space approach
removed debug output