What exactly is this part doing? The rest of `dict_add_term` is clear --- it simply adds t^exp to Mul, so it first searches if "t" is present in the dictionary, if it is, it combines it, if it isn't, it just adds it. Your code adds extra logic here, which slows things down. Is the point of this part to check if "t" is 0 or 1 and do some special cases in this case? I think there might be a better way to handle this.