changed term lookup function