This code makes it so tm calls won't call more than
necessary