modified tt function