modified to deal with added location information in parsed terms