More tf handling code