i think theres a problem with term1 sometimes not going to the right place
more efficient now, but the bug is the same