Add function for getting postion of term and add a few tests.