Added tfold optimization