This code is broken since the temporary terms array changes. It is probably not worth maintaining it.