remake term as a portable-ish function
need FIXME for term
rearrange term function